import time
t0 = time.time()
if session.authorized:

    if session.last_time and session.last_time < t0 - 60*60:
        session.flash = T('session expired')
        session.authorized = False
    else:
        session.last_time = t0

if not session.authorized  and not \
    (request.controller + '/' + request.function in
     ('pages/login')):
    redirect(URL('pages', 'login'))